﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/TangoFamilyAndGuide.Master" CodeBehind="ExploradorPublicidad.aspx.cs" Inherits="TangoFamilyAndGuide.Site.ExploradorPublicidad" Theme="Tango" Culture="en-GB" UICulture="en-GB" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="TangoFamilyAndGuideWebForm" Namespace="TangoFamilyAndGuide.WebForm" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="PanelPPal" runat="server" DefaultButton="CancelarButton">
        <table border="0" cellpadding="0" cellspacing="0" style="padding-left:10px">
            <tr>
                <td align="center" colspan="2" style="padding-top:20px">
                    <asp:Label ID="TituloPaginaLabel" runat="server" SkinID="TituloPagina" Text="Explorador de Publicidad"></asp:Label>
                    <asp:Label ID="TargetControlIDdelModalPopupExtender1" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="2" style="padding-top: 20px">
                    <asp:Label ID="Label1" runat="server" SkinID="TituloPaginaClaro" Text="Add New Image"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="2" valign="bottom" style="padding-right: 5px; padding-top: 20px">
                    <asp:Label ID="VistaPreviaLabel" runat="server" Text="Preview"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-right: 5px; padding-top: 20px; width: 10px;">
                    <asp:Image ID="ImageParaAgregar" runat="server" BorderStyle="Solid" BorderWidth="1px" 
                    BorderColor="#cccccc" ImageUrl="~/Imagenes/Interrogacion.jpg" Width="90px" />
                </td>
                <td align="left" valign="top" style="padding-top: 20px;">
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td align="left">
                                <asp:Label ID="Label4" runat="server" Text="(type of files: jpg, jpeg, png o gif)"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                <asp:Label ID="MaximoPermitidoLabel" runat="server" Text="Maximum size 1Mb."></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                <asp:FileUpload ID="FileUpload1" runat="server" ToolTip="Select your image"
                                    Width="350px" TabIndex="1" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                <asp:Button ID="SubirImagenButton" runat="server" TabIndex="2" Text="Upload selected image"
                                    Width="350px" OnClick="SubirImagenButton_Click" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="2" style="padding-top: 5px">
                    <asp:Button ID="BorrarImagenButton" runat="server" Text="Delete" Width="90px"
                        OnClick="BorrarImagenButton_Click" />
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-top:20px; padding-right:5px; padding-left:5px">
                    <asp:Label ID="CatalogoLabel" runat="server" TabIndex="1" Text="Catalogo:"></asp:Label>
                </td>
                <td align="left" style="padding-top:20px; width:250px">
                    <asp:TextBox ID="CatalogoTextBox" runat="server" TabIndex="1" Text="Catalogo1" ReadOnly="true" BackColor="LightGray"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-top:2px; padding-right:5px; padding-left:5px">
                    <asp:Label ID="ImageUrlLabel" runat="server" TabIndex="1" Text="Image Url:"></asp:Label>
                </td>
                <td align="left" style="padding-top:2px; width:250px">
                    <asp:TextBox ID="ImageUrlTextBox" runat="server" MaxLength="250" TabIndex="1" Width="300px" ReadOnly="true" BackColor="LightGray"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-top:2px; padding-right:5px; padding-left:5px">
                    <asp:Label ID="NavigateUrlLabel" runat="server" TabIndex="1" Text="Navigate Url:"></asp:Label>
                </td>
                <td align="left" style="padding-top:2px; width:250px">
                    <asp:TextBox ID="NavigateUrlTextBox" runat="server" MaxLength="250" TabIndex="2" Width="300px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-top:2px; padding-right:5px; padding-left:5px">
                    <asp:Label ID="AlternateTextLabel" runat="server" TabIndex="1" Text="Alternate Text:"></asp:Label>
                </td>
                <td align="left" style="padding-top:2px; width:250px">
                    <asp:TextBox ID="AlternateTextTextBox" runat="server" MaxLength="250" TabIndex="3" Width="300px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-top:2px; padding-right:5px; padding-left:5px">
                    <asp:Label ID="ImpressionLabel" runat="server" TabIndex="1" Text="Impression:"></asp:Label>
                </td>
                <td align="left" style="padding-top:2px; width:50px">
                    <asp:TextBox ID="ImpressionTextBox" runat="server" MaxLength="250" TabIndex="4" Width="300px"></asp:TextBox>
                    <asp:RegularExpressionValidator id="reImpression" ControlToValidate="ImpressionTextBox" ValidationExpression="[0-9]*" ErrorMessage="Solo Numeros" Display="Dynamic" runat="server" SetFocusOnError="true" ForeColor="Red">*</asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-top:2px; padding-right:5px; padding-left:5px">
                    <asp:Label ID="KeywordLabel" runat="server" TabIndex="1" Text="Keyword:"></asp:Label>
                </td>
                <td align="left" style="padding-top:2px; width:250px">
                    <asp:TextBox ID="KeywordTextBox" runat="server" MaxLength="250" TabIndex="5" Width="300px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-top:20px">
                    <asp:Button ID="AceptarButton" runat="server" Text="Aceptar" TabIndex="6" onclick="AgregarImagenButton_Click" OnClientClick="BorrarMensaje()" UseSubmitBehavior="false" />
                </td>
                <td align="left" style="padding-top:20px">
                    <asp:Button ID="CancelarButton" runat="server" Text="Cancelar" TabIndex="7" OnClick="CancelarImagenButton_Click" OnClientClick="BorrarMensaje()" />
                </td>
            </tr>
            <tr>
                <td align="center" colspan="2" style="padding-top: 20px">
                    <asp:Label ID="MensajeLabel" runat="server" SkinID="MensajePagina" Text=""></asp:Label>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="padding-top: 20px">
                    <asp:Panel ID="Panel1" runat="server" BackColor="black" BorderColor="black" BorderStyle="Solid"
                        BorderWidth="1px" ScrollBars="Auto" Width="900px" BackImageUrl="">
                        <cc1:paginggridview id="PublicidadPagingGridView" runat="server" onpageindexchanging="PublicidadPagingGridView_PageIndexChanging"
                            onrowdatabound="PublicidadPagingGridView_RowDataBound" footerstyle-forecolor="Brown"
                            onrowediting="PublicidadPagingGridView_RowEditing" onrowcancelingedit="PublicidadPagingGridView_RowCancelingEdit"
                            onrowupdating="PublicidadPagingGridView_RowUpdating" onsorting="PublicidadPagingGridView_Sorting"
                            allowpaging="True" allowsorting="True" pagesize="5" autogeneratecolumns="false"
                            skinid="GrillaGuide" onrowcommand="PublicidadPagingGridView_RowCommand" onselectedindexchanged="PublicidadPagingGridView_SelectedIndexChanged"
                            onselectedindexchanging="PublicidadPagingGridView_SelectedIndexChanging" 
                            datakeynames="" onrowdeleted="PublicidadPagingGridView_RowDeleted" 
                            onrowdeleting="PublicidadPagingGridView_RowDeleting">
                            <Columns>
                                <asp:TemplateField ItemStyle-VerticalAlign="Top">
                                    <HeaderStyle Wrap="False" BorderColor="White" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="Ver" runat="server" CausesValidation="false" CommandName="Detalle" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" ToolTip="<%# ((GridViewRow) Container).RowIndex %>" Text="Detalle" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField ItemStyle-VerticalAlign="Top">
                                    <HeaderStyle Wrap="False" BorderColor="White" />
                                    <ItemTemplate>
                                        <asp:LinkButton Id="CambiarEstado" runat="server" CausesValidation="false" CommandName="CambiarEstado"  CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" ToolTip="<%# ((GridViewRow) Container).RowIndex %>" Text="Cambiar estado" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Catalogo" HeaderText="Catalogo" SortExpression="Catalogo" HeaderStyle-Width="200px" ReadOnly="true">
                                    <HeaderStyle HorizontalAlign="Center" Wrap="false" ForeColor="Brown" BorderColor="White" />
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Wrap="true" />
                                </asp:BoundField>
                                <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" ReadOnly="true" 
                                    HeaderStyle-Width="250px">
                                    <HeaderStyle Wrap="False" BorderColor="White" />
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Wrap="true" />
                                </asp:BoundField>
                                <asp:BoundField DataField="ImageUrl" HeaderText="ImageUrl" SortExpression="ImageUrl" HeaderStyle-Width="120px" ReadOnly="true">
                                    <HeaderStyle Wrap="False" BorderColor="White" />
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Wrap="True" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="NavigateUrl" HeaderStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Top"
                                    FooterStyle-VerticalAlign="Top">
                                    <HeaderStyle Wrap="False" BorderColor="White" Font-Bold="false" Width="150px" />
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtNavigateUrl" runat="server" Text='<%# Bind("NavigateUrl") %>'
                                            MaxLength="250"></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <%# Eval("NavigateUrl")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="AlternateText" HeaderStyle-HorizontalAlign="Center" ControlStyle-Width="120px" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign="Top">
                                    <HeaderStyle Wrap="False" BorderColor="White" Font-Bold="false" Width="150px" />
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtAlternateText" runat="server" Text='<%# Bind("AlternateText") %>'
                                            MaxLength="250"></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <%# Eval("AlternateText")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Estado" HeaderText="Estado" SortExpression="Estado" ReadOnly="true" 
                                    HeaderStyle-Width="100px">
                                    <HeaderStyle Wrap="False" BorderColor="White" />
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Wrap="True" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="Impression" HeaderStyle-HorizontalAlign="Center" ControlStyle-Width="50px" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign="Top">
                                    <HeaderStyle Wrap="False" BorderColor="White" Font-Bold="false" />
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtImpression" runat="server" Text='<%# Bind("Impression") %>'
                                            MaxLength="2" Width="50px"></asp:TextBox>
                                            <asp:RegularExpressionValidator id="retxtImpression" ControlToValidate="txtImpression" ValidationExpression="[0-9]*" ErrorMessage="Solo Numeros" Display="Dynamic" runat="server" SetFocusOnError="true" ForeColor="Red">*</asp:RegularExpressionValidator>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <%# Eval("Impression")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Keyword" HeaderStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Top"
                                    FooterStyle-VerticalAlign="Top">
                                    <HeaderStyle Wrap="False" BorderColor="White" Font-Bold="false" Width="100px" />
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtKeyword" runat="server" Text='<%# Bind("Keyword") %>'
                                            MaxLength="250" Width="100px"></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <%# Eval("Keyword")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Edit" ShowHeader="False" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" ItemStyle-VerticalAlign="Top" FooterStyle-VerticalAlign="Top">
                                    <HeaderStyle Wrap="False" BorderColor="White" Font-Bold="false" />
                                    <EditItemTemplate>
                                        <asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="True" CommandName="Update" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"  
                                            Text="Update" OnClientClick="return confirm('Update?')" ValidationGroup="Update"></asp:LinkButton>
                                        <asp:ValidationSummary ID="vsUpdate" runat="server" ShowMessageBox="true" ShowSummary="false"
                                            ValidationGroup="Update" Enabled="true" HeaderText="Validation Summary..." />
                                        <asp:LinkButton ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" 
                                            Text="Cancel"></asp:LinkButton>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="False" CommandName="Edit" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
                                            Text="Edit"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField ItemStyle-VerticalAlign="Top">
                                    <HeaderStyle Wrap="False" BorderColor="White" />
                                    <ItemTemplate>
                                        <asp:LinkButton Id="Delete" runat="server" CausesValidation="false" CommandName="Delete" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" ToolTip="<%# ((GridViewRow) Container).RowIndex %>" Text="Eliminar" OnClientClick="return confirm('Delete?')" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderStyle-Width="100px">
                                    <HeaderStyle Wrap="False" BorderColor="White" />
                                    <ItemTemplate>
                                        <a href='<%# Eval("NavigateUrl") %>' target="_blank"><asp:ImageButton ID="ImageButton1" runat="server" ToolTip='<%# Eval("NavigateUrl") %>' ImageUrl='<%# String.Format("~/ImagenesPublicidad/Catalogo1/{0}", Eval("ImageUrl")) %>' Height="100px" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" /></a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <PagerSettings Mode="NumericFirstLast" />
                        </cc1:paginggridview>
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
    TargetControlID="TargetControlIDdelModalPopupExtender1"
    PopupControlID="ConfirmacionPanel"
    BackgroundCssClass="modalBackground"
    PopupDragHandleControlID="ConfirmacionPanel"
    BehaviorID="mdlPopup" />
    <asp:Panel ID="ConfirmacionPanel" runat="server" CssClass="ModalWindow">
        <table width="100%">
            <tr>
                <td colspan="2">
                    <asp:Label ID="TituloConfirmacionLabel" runat="server" SkinID="TituloPagina"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-right:5px; padding-left:5px">
                    Catalogo:
                </td>
                <td align="left">
                    <asp:Label ID="IdCatalogoPopupLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-right:5px; padding-left:5px">
                    Id.:
                </td>
                <td align="left">
                    <asp:Label ID="IdPublicidadPopupLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-right:5px; padding-left:5px">
                    ImageUrl:
                </td>
                <td align="left">
                    <asp:Label ID="ImageUrlPopupLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-right:5px; padding-left:5px">
                    NavigateUrl:
                </td>
                <td align="left" style="width:250px">
                    <asp:Label ID="NavigateUrlPopupLabel" runat="server"></asp:Label>
                </td>
            </tr>             
            <tr>
                <td align="left" style="padding-right:5px; padding-left:5px">
                    AlternateText:
                </td>
                <td align="left">
                    <asp:Label ID="AlternateTextPopupLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-right: 5px; padding-left: 5px">
                    Impression:
                </td>
                <td align="left">
                    <asp:Label ID="ImpressionPopupLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-right: 5px; padding-left: 5px">
                    Keyword:
                </td>
                <td align="left">
                    <asp:Label ID="KeywordPopupLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-right:5px; padding-left:5px">
                    Estado:
                </td>
                <td align="left">
                    <asp:Label ID="EstadoPopupLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="left" style="padding-right:5px; padding-left:5px">
                    Usuario:
                </td>
                <td align="left">
                    <asp:Label ID="UsuarioPopupLabel" runat="server"></asp:Label>
                </td>
            </tr>      
            <tr>
                <td align="left" style="padding-top:20px">
                    <asp:Button ID="CambiarEstadoButton" runat="server" Text="Confirmar" onclick="CambiarEstadoButton_Click" OnClientClick="this.disabled = true; BorrarMensaje()" UseSubmitBehavior="false" />
                </td>
                <td align="left" style="padding-top:20px">
                    <asp:Button ID="Button1" runat="server" Text="Cancelar" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    <script type="text/javascript">
        function BorrarMensaje() {
            {
                document.getElementById('<%=MensajeLabel.ClientID%>').innerHTML = '';
            }
        }
    </script>
</asp:Content>
